Change in openvpn[master]: buffer: Clarify usage of char_class
A message that is not in the archive (sent off-list or not yet received): gerrit.1754656456000.I73bc163d48b2d6a954cd231961826f33143fcd12@...2715...
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/1142?usp=email
to review the following change.
Change subject: buffer: Clarify usage of char_class
......................................................................
buffer: Clarify usage of char_class
Silence compiler warnings due to conversion from
char to unsigned char. In this case we actually
depend on this conversion.
---
M src/openvpn/buffer.c
1 file changed, 11 insertions(+), 2 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/42/1142/1
src/openvpn/buffer.c +11 -2
@@ -560,7 +560,7 @@ {break ; } -if (char_class (*last,CC_CRLF |CC_NULL )) +if (char_class ((unsigned char )*last,CC_CRLF |CC_NULL )) {if (!buf_inc_len (buf,-1 )) {
@@ -872,6 +872,14 @@* Classify and mutate strings based on character types. */ +/* Note 1: This functions depends on getting an unsigned +char. Both the is*() functions and our own checks expect it +this way. +Note 2: For CC_PRINT we just accept everything >= 32, so +if we ingest non-ASCII UTF-8 we will classify it as +printable since it will be >= 128. Other encodings are +not officially supported. +*/ bool char_class (const unsigned char c,const unsigned int flags) {
@@ -1015,7 +1023,8 @@static inline bool char_inc_exc (const char c,const unsigned int inclusive,const unsigned int exclusive) { -return char_class (c, inclusive) && !char_class (c, exclusive); +return char_class ((unsigned char )c, inclusive) + && !char_class ((unsigned char )c, exclusive); }bool
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1142?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I73bc163d48b2d6a954cd231961826f33143fcd12
Gerrit-Change-Number: 1142
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-MessageType: newchange
Attention is currently required from: plaisthos.
flichtenheld has posted comments on this change by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1142?usp=email )
Change subject: buffer: Clarify usage of char_class
......................................................................
Patch Set 5:
(1 comment)
This change is ready for review.
Patchset:
PS5:
Remove dependency on "Enable -Wsign-conversion" commit and submit as its own change.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1142?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I73bc163d48b2d6a954cd231961826f33143fcd12
Gerrit-Change-Number: 1142
Gerrit-PatchSet: 5
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Thu, 12 Feb 2026 12:37:16 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1142?usp=email
to look at the new patch set (#6).
Change subject: buffer: Clarify usage of char_class
......................................................................
buffer: Clarify usage of char_class
Silence compiler warnings due to conversion from
char to unsigned char. In this case we actually
depend on this conversion.
---
M src/openvpn/buffer.c
1 file changed, 15 insertions(+), 2 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/42/1142/6
src/openvpn/buffer.c +15 -2
@@ -545,6 +545,10 @@buf_write_u8 (buf,0 ); } +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic pop +#endif +/* * Remove trailing \r and \n chars and ensure * null termination.
@@ -559,7 +563,7 @@ {break ; } -if (char_class (*last,CC_CRLF |CC_NULL )) +if (char_class ((unsigned char )*last,CC_CRLF |CC_NULL )) {if (!buf_inc_len (buf,-1 )) {
@@ -876,6 +880,14 @@* Classify and mutate strings based on character types. */ +/* Note 1: This functions depends on getting an unsigned +char. Both the is*() functions and our own checks expect it +this way. +Note 2: For CC_PRINT we just accept everything >= 32, so +if we ingest non-ASCII UTF-8 we will classify it as +printable since it will be >= 128. Other encodings are +not officially supported. +*/ bool char_class (const unsigned char c,const unsigned int flags) {
@@ -1019,7 +1031,8 @@static inline bool char_inc_exc (const char c,const unsigned int inclusive,const unsigned int exclusive) { -return char_class (c, inclusive) && !char_class (c, exclusive); +return char_class ((unsigned char )c, inclusive) + && !char_class ((unsigned char )c, exclusive); }bool
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1142?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I73bc163d48b2d6a954cd231961826f33143fcd12
Gerrit-Change-Number: 1142
Gerrit-PatchSet: 6
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1142?usp=email
to look at the new patch set (#7).
Change subject: buffer: Clarify usage of char_class
......................................................................
buffer: Clarify usage of char_class
Silence compiler warnings due to conversion from
char to unsigned char. In this case we actually
depend on this conversion.
---
M src/openvpn/buffer.c
1 file changed, 11 insertions(+), 2 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/42/1142/7
src/openvpn/buffer.c +11 -2
@@ -559,7 +559,7 @@ {break ; } -if (char_class (*last,CC_CRLF |CC_NULL )) +if (char_class ((unsigned char )*last,CC_CRLF |CC_NULL )) {if (!buf_inc_len (buf,-1 )) {
@@ -876,6 +876,14 @@* Classify and mutate strings based on character types. */ +/* Note 1: This functions depends on getting an unsigned +char. Both the is*() functions and our own checks expect it +this way. +Note 2: For CC_PRINT we just accept everything >= 32, so +if we ingest non-ASCII UTF-8 we will classify it as +printable since it will be >= 128. Other encodings are +not officially supported. +*/ bool char_class (const unsigned char c,const unsigned int flags) {
@@ -1019,7 +1027,8 @@static inline bool char_inc_exc (const char c,const unsigned int inclusive,const unsigned int exclusive) { -return char_class (c, inclusive) && !char_class (c, exclusive); +return char_class ((unsigned char )c, inclusive) + && !char_class ((unsigned char )c, exclusive); }bool
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1142?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I73bc163d48b2d6a954cd231961826f33143fcd12
Gerrit-Change-Number: 1142
Gerrit-PatchSet: 7
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Attention is currently required from: flichtenheld, plaisthos.
cron2 has posted comments on this change by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1142?usp=email )
Change subject: buffer: Clarify usage of char_class
......................................................................
Patch Set 7: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1142?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I73bc163d48b2d6a954cd231961826f33143fcd12
Gerrit-Change-Number: 1142
Gerrit-PatchSet: 7
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Wed, 04 Mar 2026 10:49:52 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
PATCH v7 1/1 buffer: Clarify usage of char_class
In reply to a message not in the archiveFrom: Frank Lichtenheld <[email protected]...>
Silence compiler warnings due to conversion from
char to unsigned char. In this case we actually
depend on this conversion.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1142
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1142
This mail reflects revision 7 of this Change.
Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>
src/openvpn/buffer.c +11 -2
@@ -559,7 +559,7 @@ {break ; } -if (char_class (*last,CC_CRLF |CC_NULL )) +if (char_class ((unsigned char )*last,CC_CRLF |CC_NULL )) {if (!buf_inc_len (buf,-1 )) {
@@ -876,6 +876,14 @@* Classify and mutate strings based on character types. */ +/* Note 1: This functions depends on getting an unsigned +char. Both the is*() functions and our own checks expect it +this way. +Note 2: For CC_PRINT we just accept everything >= 32, so +if we ingest non-ASCII UTF-8 we will classify it as +printable since it will be >= 128. Other encodings are +not officially supported. +*/ bool char_class (const unsigned char c,const unsigned int flags) {
@@ -1019,7 +1027,8 @@static inline bool char_inc_exc (const char c,const unsigned int inclusive,const unsigned int exclusive) { -return char_class (c, inclusive) && !char_class (c, exclusive); +return char_class ((unsigned char )c, inclusive) + && !char_class ((unsigned char )c, exclusive); }bool
[Openvpn-devel] [PATCH applied] Re: buffer: Clarify usage of char_class
Easy and straightforward enough, plus extra documentation :-)
I have not tested this beyond BB, but given the nature of the change and that all these casts have been (implicitly) there already, I do not expect surprises. Nightly t_server tests will complain if I'm wrong.
Your patch has been applied to the master branch.
commit 9735675529450467ff5ad5e6500caef4d225b17b
Author: Frank Lichtenheld Date: Wed Mar 4 11:50:01 2026 +0100
buffer: Clarify usage of char_class
Signed-off-by: Frank Lichtenheld <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1142
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35867.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has uploaded a new patch set (#8) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1142?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by cron2
Change subject: buffer: Clarify usage of char_class
......................................................................
buffer: Clarify usage of char_class
Silence compiler warnings due to conversion from
char to unsigned char. In this case we actually
depend on this conversion.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1142
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35867.html
---
M src/openvpn/buffer.c
1 file changed, 11 insertions(+), 2 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/42/1142/8
src/openvpn/buffer.c +11 -2
@@ -559,7 +559,7 @@ {break ; } -if (char_class (*last,CC_CRLF |CC_NULL )) +if (char_class ((unsigned char )*last,CC_CRLF |CC_NULL )) {if (!buf_inc_len (buf,-1 )) {
@@ -876,6 +876,14 @@* Classify and mutate strings based on character types. */ +/* Note 1: This functions depends on getting an unsigned +char. Both the is*() functions and our own checks expect it +this way. +Note 2: For CC_PRINT we just accept everything >= 32, so +if we ingest non-ASCII UTF-8 we will classify it as +printable since it will be >= 128. Other encodings are +not officially supported. +*/ bool char_class (const unsigned char c,const unsigned int flags) {
@@ -1019,7 +1027,8 @@static inline bool char_inc_exc (const char c,const unsigned int inclusive,const unsigned int exclusive) { -return char_class (c, inclusive) && !char_class (c, exclusive); +return char_class ((unsigned char )c, inclusive) + && !char_class ((unsigned char )c, exclusive); }bool
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1142?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I73bc163d48b2d6a954cd231961826f33143fcd12
Gerrit-Change-Number: 1142
Gerrit-PatchSet: 8
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1142?usp=email )
Change subject: buffer: Clarify usage of char_class
......................................................................
buffer: Clarify usage of char_class
Silence compiler warnings due to conversion from
char to unsigned char. In this case we actually
depend on this conversion.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1142
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35867.html
---
M src/openvpn/buffer.c
1 file changed, 11 insertions(+), 2 deletions(-)
src/openvpn/buffer.c +11 -2
@@ -559,7 +559,7 @@ {break ; } -if (char_class (*last,CC_CRLF |CC_NULL )) +if (char_class ((unsigned char )*last,CC_CRLF |CC_NULL )) {if (!buf_inc_len (buf,-1 )) {
@@ -876,6 +876,14 @@* Classify and mutate strings based on character types. */ +/* Note 1: This functions depends on getting an unsigned +char. Both the is*() functions and our own checks expect it +this way. +Note 2: For CC_PRINT we just accept everything >= 32, so +if we ingest non-ASCII UTF-8 we will classify it as +printable since it will be >= 128. Other encodings are +not officially supported. +*/ bool char_class (const unsigned char c,const unsigned int flags) {
@@ -1019,7 +1027,8 @@static inline bool char_inc_exc (const char c,const unsigned int inclusive,const unsigned int exclusive) { -return char_class (c, inclusive) && !char_class (c, exclusive); +return char_class ((unsigned char )c, inclusive) + && !char_class ((unsigned char )c, exclusive); }bool
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1142?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I73bc163d48b2d6a954cd231961826f33143fcd12
Gerrit-Change-Number: 1142
Gerrit-PatchSet: 8
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>